
<%@ page contentType="text/html;charset=UTF-8" %>
<%//@include file="../../common/sessionValidate.jsp" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<!DOCTYPE HTML>
<html lang="UTF-8">
<head>
    <title>申请信息</title>
    <%@ include file="../../common/meta.jsp" %>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta http-equiv="X-UA-Compatible" content="IE=9">
    <META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate">
    <link rel="stylesheet" href="<%=basePath%>css/my-bootstrap.css" media="screen" id="tuserskin">
    <link rel="stylesheet" href="<%=basePath%>js/toastr/toastr.css">
    <link rel="stylesheet" href="<%=basePath%>css/bootstrapValidator.min.css">
    <link rel="stylesheet" href="<%=basePath%>css/font-awesome.min.css">
    <!-- kind富文本编辑器  start-->
    <link rel="stylesheet" href="<%= basePath %>kindeditor/themes/default/default.css"/>
    <link rel="stylesheet" href="<%= basePath %>kindeditor/plugins/code/prettify.css"/>
    <script charset="utf-8" src="<%= basePath %>kindeditor/kindeditor.js"></script>
    <script charset="utf-8" src="<%= basePath %>kindeditor/lang/zh-CN.js"></script>
    <script charset="utf-8" src="<%= basePath %>kindeditor/plugins/code/prettify.js"></script>
    <!-- kind富文本编辑器  end-->
    <script type="text/javascript" src="<%= basePath %>js/jquery-1.8.3.min.js"></script>
    <script type="text/javascript" src="<%= basePath %>js/jquery.cookie.js"></script>
</head>
<style>
    hr {
        margin-top: 1px;
        border-bottom: 1px solid #1BBC9B;
    }
</style>
<script>
    var editor101; //后面赋值通过该全局变量执行；
    KindEditor.ready(function (K) {
        editor101 = K.create('textarea[name="editor101"]', {
            uploadJson: '<%= basePath %>upload/uploadFile',  //选择本地文件上传处理；
            fileManagerJson: '<%= basePath %>upload/uploadFileManager', //服务器文件浏览；
            allowFileManager: true,	//true时显示浏览远程服务器按钮。
            allowImageUpload: true	//true时显示图片上传按钮。
        });
        prettyPrint(); //google美化高亮显示富文本中html代码js；
    });
</script>
<body>
<form class="form-horizontal form-bordered form-row-strippe" name="ffAdd" id="ffAdd" mentod="post" role="form"
      data-toggle="validator" enctype="multipart/form-data">
    <div class="" style="margin-right:2px;padding-right:1px;">

        <!-------------------------- 面板  start--------------------------------->
        <div class="panel panel-primary">
            <div class="panel-heading clearfix" id="addHeaderDiv">
            </div>
            <div class="panel-body">
                <div class="row">
                    <h5>&nbsp;&nbsp;基本信息
                        <span class="text-right pull-right" id="buttonDivTB"></span>&nbsp;&nbsp;&nbsp;&nbsp;
                    </h5>
                    <hr>
                    <div class="col-xs-12">
                        <div class="col-xs-6">
                            <div class="form-group">
                                <label class="control-label col-xs-2"><font color="red">*</font>补卡时间</label>
                                <div class="col-xs-10">
                                    <input id="newdate" name="newdate" type="text" class="form-control"
                                           onclick='SelectDate(this)' placeholder="" readonly="true"/>
                                </div>
                            </div>
                        </div>
                        <div class="col-xs-6">
                            <div class="form-group">
                                <label class="control-label col-xs-2"><font color="red">*</font>申请人</label>
                                <div class="col-xs-10">
                                    <input id="creater" name="creater" type="text"
                                           readonly="true"  value="<%=request.getSession().getAttribute("username") %>(<%=request.getSession().getAttribute("FREE_CURRENT_USER") %>)"
                                           class="form-control" placeholder="" />
                                </div>
                            </div>
                        </div>
                    </div><!--end 换列--><!--start 换列-->
                    <div class="col-xs-12">
                        <!--<div class="col-xs-12">start 换列-->
                        <div class="col-xs-6">
                            <div class="form-group">
                                <label class="control-label col-xs-2"><font color="red">*</font>补卡理由</label>
                                <div class="col-xs-10">
                                    <input id="title" name="title" class="form-control"
                                           placeholder=""></input>
                                    <input id="content" name="content" type="hidden"/>
                                    <input id="id" name="id" type="hidden"/>
                                    <input id="biztype" name="biztype" type="hidden" value="MyApply"/>
                                    <input id="level1name" name="level1name" type="hidden" value="补卡申请"/>
                                    <input id="types" name="types" type="hidden" value="AddcardApply"/>
                                </div>
                            </div>
                        </div>
                        <div class="col-xs-6">
                            <div class="form-group">
                                <label class="control-label col-xs-2"><font color="red">*</font>申请时间</label>
                                <div class="col-xs-10">
                                    <input id="creattime" name="creattime" type="text" class="form-control"
                                           placeholder="" readonly="true"/>
                                </div>
                            </div>
                        </div>
                    </div><!-- end 内容 -->
                    <div class="col-xs-12">
                        <div class="col-xs-6">
                            <div class="form-group">
                                <label class="control-label col-xs-2">补卡时间2</label>
                                <div class="col-xs-10">
                                    <input id="ext2" name="ext2" type="text" class="form-control"
                                           onclick='SelectDate(this)' placeholder="" readonly="true"/>
                                </div>
                            </div>
                        </div>
                        <div class="col-xs-6">
                            <div class="form-group">
                                <label class="control-label col-xs-2">补卡时间3</label>
                                <div class="col-xs-10">
                                    <input id="ext3" name="ext3" type="text" class="form-control"
                                           onclick='SelectDate(this)' placeholder="" readonly="true"/>
                                </div>
                            </div>
                        </div>
                    </div><!--end 换列--><!--start 换列-->
                    <div class="col-xs-12">
                        <div class="col-xs-6">
                            <div class="form-group">
                                <label class="control-label col-xs-2">补卡时间4</label>
                                <div class="col-xs-10">
                                    <input id="ext4" name="ext4" type="text" class="form-control"
                                           onclick='SelectDate(this)' placeholder="" readonly="true"/>
                                </div>
                            </div>
                        </div>
                        <div class="col-xs-6">
                            <div class="form-group">
                                <label class="control-label col-xs-2">补卡时间5</label>
                                <div class="col-xs-10">
                                    <input id="ext5" name="ext5" type="text" class="form-control"
                                           onclick='SelectDate(this)' placeholder="" readonly="true"/>
                                </div>
                            </div>
                        </div>
                    </div><!--end 换列--><!--start 换列-->
                    <div class="col-xs-12">
                        <div class="col-xs-6">
                            <div class="form-group">
                                <label class="control-label col-xs-2">申请部门</label>
                                <div class="col-xs-10">
                                    <input id="hticount" name="hticount" type="text"
                                           value="<%=request.getSession().getAttribute("FREE_BRANCH_NAME") %>"
                                           class="form-control" placeholder="" readonly="true"/>
                                </div>
                            </div>
                        </div>
                    </div><!--end 换列--><!--start 换列-->
                </div><!--end body-->
                <div class="modal-footer bg-info " id='buttonDiv'>
                </div>
            </div>
        </div>
        <!--------------------------面板 end------------------------------------>

    </div>
</form>

<!-- 模态框（Modal）start -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
     aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title" id="myModalLabel">提示</h4>
            </div>
            <div class="modal-body" id="myModalMessDiv"></div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal -->
</div>
<!-- 模态框（Modal）end -->
<!-------------------------- 审核面板  start--------------------------------->
<%@ include file="../../index/shenheDiv.jsp" %>
<!-------------------------- 审核面板  end--------------------------------->

</body>
</html>
<%!
    private String htmlspecialchars(String str) { //kindeditor去掉富文本中非法字符；
        str = str.replaceAll("&", "&amp;");
        str = str.replaceAll("<", "&lt;");
        str = str.replaceAll(">", "&gt;");
        str = str.replaceAll("\"", "&quot;");
        return str;
    }
%>
<script src="<%=basePath%>js/bootstrap.min.js"></script>
<!--<script src="<%=basePath%>js/jquery-1.10.2/jquery.min.js"></script>
<script type="text/javascript" src="js/bootstrapValidator.js"></script>-->
<script src="<%=basePath%>js/bootstrap-paginator.min.js"></script>
<script src="<%=basePath%>/js/respond.js"></script>
<script src="<%=basePath%>/js/html5.js"></script>
<script src="<%=basePath%>js/toastr/toastr.js"></script>
<script src="<%=basePath%>js/bootbox.js"></script>
<script src="<%=basePath%>js/jquery.validate.js"></script>
<!-- <script src="<%=basePath%>js/additional-methods.min.js"></script> -->
<script src="<%=basePath%>js/my-jquery-curd.js"></script>
<script src="<%= basePath %>js/tableSortTool.js" ></script>
<script src="<%= basePath %>js/calendar.js" ></script>
<script type="text/javascript">
    //审核通过提交表单；
    function shtg() {
        var url = "<%=basePath%>t_news/shtgT_news?time=" + Math.random();
        bootbox.confirm({
            size: 'small',
            buttons: {
                confirm: {
                    label: '  确认   ',
                    className: 'btn btn-sm btn-danger'
                },
                cancel: {
                    label: '  取消    ',
                    className: 'btn btn-success btn-sm'
                }
            },
            message: '您确认要审核通过？',
            callback: function (result) {
                if (result) { if (result) { myCurdShtg(url); }}
            },
            title: '确认提示：',
            className: ' '
        })
    }

    //审核退回提交表单；
    function shth() {
        var url = "<%=basePath%>t_news/shthT_news?time=" + Math.random();
        bootbox.confirm({
            size: 'small',
            buttons: {
                confirm: {
                    label: ' 退回 ',
                    className: 'btn btn-sm btn-danger'
                },
                cancel: {
                    label: '   取消     ',
                    className: 'btn btn-success btn-sm'
                }
            },
            message: '您确认要退回？',
            callback: function (result) {
                if (result) {if (result) {myCurdShth(url);}}
            },
            title: '确认提示：',
            className: ' '
        })
    }

    //审核退回提交表单；
    function shthzfqr() {
        var url = "<%=basePath%>t_news/shthzfqrT_news?time=" + Math.random();
        bootbox.confirm({
            size: 'small',
            buttons: {
                confirm: {
                    label: ' 退回 ',
                    className: 'btn btn-sm btn-danger'
                },
                cancel: {
                    label: '   取消     ',
                    className: 'btn btn-success btn-sm'
                }
            },
            message: '您确认要退回至发起人并结束流程？',
            callback: function (result) {
                if (result) {if (result) {myCurdShth(url);}}
            },
            title: '确认提示：',
            className: ' '
        })
    }

    //展示附件文件列表；
    function showFileList(oldfilenames, newfilenames){
        var showmess= oldfilenames.split(";");
        var newfilename= newfilenames.split(";");
        var trtdlist = "";
        for (var i = 0; i < showmess.length; i++ ){
            trtdlist += "<tr><td><a href='<%=basePath%>download?filename="+newfilename[i]+"'>"+showmess[i]+"</a></td></tr>";
        }
        $("#fileListDiv").html("");
        document.getElementById("fileListDiv").innerHTML = trtdlist;
    }

    //初始化页面加载表单值；
    $().ready(function () {
        //1、初始化数据显示
        var name = "用印申请";
        var id = '<%=request.getParameter("appid")%>';
        var tninstanceid = '<%=request.getParameter("tninstanceid")%>';
        var oplx = '<%=request.getParameter("oplx")%>';
        var taskid = '<%=request.getParameter("taskid")%>';
        var instanceid = '<%=request.getParameter("instanceid")%>';

        //设置审核意见表单默认值；
        $("#tninstanceid").val(tninstanceid);
        $("#appid").val(id);
        var basePath = "<i class='icon-eye-open'></i>&nbsp;";//设置addHeaderDiv标题文字及按钮
        setHeader2("审核" + name, basePath);
        //setButtonDivView2();//设置adddiv的 操作按钮
        var url = "<%=basePath%>t_news/getT_news?id=" + id + "&time=" + Math.random();
        //alert("url="+url);
        $.getJSON(url, function (data) {//获取数据，并且自动填充form，自动代码待修改； @todo;
            setValue(data);
            showFileList(data.ext9, data.imagepath); //设置附件列表展示；
            editor101.html(data.content);
            //$("#ext3").attr("disabled", true);
            //alert($("#effect_date").val()+""+jsonDateFormat($("#effect_date").val()));
            //$("#effect_date").val(jsonDateFormat($("#effect_date").val())); //重新设置日期类型的值
        });
        formReadOnly2('ffAdd');//设置表单不可修改; 会影响所有表单输入框；

        //如果是审核进来的；还是查看历史任务进来的；现实不同按钮
        if (oplx == 'check') {
            $("#checkButtonDiv").show();
            $("#hisButtonDiv").hide();
            $("#note").removeAttr("readOnly");
        } else if (oplx == 'his') {
            $("#checkButtonDiv").hide();
            $("#hisButtonDiv").show();
            $("#note").attr("readOnly", "true");
        }

    }) //end funciton read;
</script>
